package com.ceshi;

import java.lang.reflect.Method;

/**
 * @author Jack
 * @description: TODO
 * @date 2021/10/14 10:49
 */
public class HuaweiPhone implements Phone {
    public void createPhone() {
        System.out.println("生产华为手机");
    }

    public static void main(String[] args) throws Exception{
        Method[] methods=HuaweiPhone.class.getDeclaredMethods();
        Method[] methods2=Phone.class.getDeclaredMethods();
        boolean bo=methods[0].getDeclaringClass()==HuaweiPhone.class;

        System.out.println(bo);
        System.out.println(HuaweiPhone.class.newInstance() instanceof Phone);

        System.out.println(methods2[0].getDeclaringClass().isAssignableFrom(HuaweiPhone.class));
        System.out.println("isInterface="+methods2[0].getDeclaringClass().isInterface());
        System.out.println(methods[0].getDeclaringClass().isAssignableFrom(Phone.class));
    }
}
